<template>
  <div class="app-container">
    <el-form ref="form" :model="form" :rules="rules" label-width="80px" style="width: 1000px;">
      <el-form-item label="注：">
        <span>平面图最大分辨率为1920*1080，超出恐造成变形！发布名称为20个字以内最佳！</span>
      </el-form-item>
      <el-form-item label="图片">
        <uploadImage v-model="form.relPmtPic"/>
      </el-form-item>
      <el-form-item label="发布名称" prop="indexset">
        <el-input v-model="form.indexset" placeholder="请输入发布名称" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submitForm">确 定</el-button>
    </div>
    <img :src="form.relPmtPic" style="width: 1920px;height: 1080px;">
  </div>
</template>

<script>
  import { getSysConfig, updateSysConfig } from "@/api/basic/sysConfig";
  import UploadImage from '@/components/UploadImage';

  export default {
    components: {
      UploadImage
    },
    data() {
      return {
        // 表单参数
        form: {},
        // 表单校验
        rules: {
        }
      };
    },
    created() {
      this.handleUpdate();
    },
    methods: {
// 表单重置
      reset() {
        this.form = {
          id: null,
          relPmtPic: null,
        };
        this.resetForm("form");
      },
      /** 修改按钮操作 */
      handleUpdate() {
        this.reset();
        getSysConfig().then(response => {
          this.form = response.data;
        });
      },
      /** 提交按钮 */
      submitForm() {
        this.$refs["form"].validate(valid => {
          if (valid) {
            updateSysConfig(this.form).then(response => {
              this.msgSuccess("修改成功");
            });
          }
        });
      },
    }
  };
</script>
